package com.lry.basic.thread;

import lombok.SneakyThrows;

//wait让出cpu，释放锁
//sleep让出cpu，阻塞，不释放锁
//yield让出cpu，不阻塞，进入就绪状态，重新争夺cpu
public class TestThread {


    public static void main(String[] args) {
        for(int i=0;i<10;i++){
            MyThread thread = new MyThread();
            thread.start();
        }

        MyThread thread = new MyThread();
        thread.start();

    }


    static class MyThread extends Thread{
        @SneakyThrows
        @Override
        public void run() {
            System.out.println(Thread.currentThread().getName());

            while(true){}
        }
    }

}
